<template>
  <div>
    <el-dialog
      @closed="handleMattClose"
      v-model="props.openMatting"
      title="图片处理"
      width="900px"
      append-to-body
    >
      <div style="display: flex; align-items: center; gap: 20px">
        <image-preview :src="props.choseItemImage" :width="100" :height="100" />
        <image-preview :src="props.choseItemImage" :width="100" :height="100" />
      </div>
      <el-button type="primary" style="margin: 20px 0;" @click="handleMatting">抠图</el-button>
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="dispense">无需处理</el-button>
          <el-button type="primary" @click="handleImageSure(AddBrandRef)">
            确定
          </el-button>
          <el-button @click="handleBrandVisibleClose">取消</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>
<script setup>
import { defineProps, defineEmits, watch } from "vue";
const emits = defineEmits(["handleMattClose",'handleImageSure']);
const props = defineProps({
  openMatting: {
    type: Boolean,
    default: false,
  },
  //   详情的具体数据
  item: {
    type: Object,
    default: {},
  },
  //选择照片的具体数据
  choseItemImage: {
    type: Object,
    default: "",
  },
  imageType:{
    type: String,
    default: "main",//默认是主图Main，（main，detail）
  }
});
// 取消
const handleMattClose = () => {
  emits("handleMattClose");
};
// 无需处理
const dispense=()=>{
    handleMattClose()

}
// 确定
const handleImageSure=()=>{

}
// 抠图
const handleMatting=()=>{
    product.product.productTrimimage({
      data: {
        imageUrl:'https://cbu01.alicdn.com/img/ibank/O1CN01b96f8J1JG2p5Q4LKs_!!2912191000-0-cib.jpg',
        imageType:props.imageType,
        productId:props.item.id

      }
    }).then((res) => {
        console.log(res,'[[[[]]]]');
        
    }).catch((err) => {
        
    });

}
</script>